﻿using Company.Common;
using Company.Common.Queue;
using Company.IO.Interfaces;
using Company.System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Company.IO.Tests
{
    public class Testing
    {
        public string Parameter { get; set; }
    }

    [TestClass]
    public class FileSystemQueueTest
    {
        public TestContext TestContext { get; set; }

        public void FileSystemQueueConstructorTestHelper<TQueueItem>() where TQueueItem : class, new()
        {
            IFileSystem fileSystem = new FileSystem(new Directory(), new Path(), new File());

            IQueue target = new FileSystemQueue<TQueueItem>(fileSystem);
            target.OnNewItemAdded += OnNewItemAdded;
            
            var queueItem = new TQueueItem();

            target.Enqueue(queueItem);
            target.Enqueue(queueItem);
            target.Enqueue(queueItem);
            target.Enqueue(queueItem);

            TQueueItem outItem;
            if (target.TryDequeue(out outItem))
            {
            }
        }

        void OnNewItemAdded(object sender, global::System.EventArgs e)
        {
        }

        [TestMethod]
        public void FileSystemQueueConstructorTest()
        {
            FileSystemQueueConstructorTestHelper<Testing>();
        }
    }
}